package com.gaoyuzhe.controller;

import com.gaoyuzhe.entities.Payment;
import com.gaoyuzhe.to.ReturnValue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author gaoyuzhe
 */
@RestController
@RequestMapping("/nacos")
public class OrderController {
    @Value("${service-url.cloud-alibaba-provider-payment}")
    private  String paymentUrl;


    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/consumer/get/{id}")
    public String getPayment(@PathVariable Long id) {
        return  restTemplate.getForObject(paymentUrl +"/nacos/payment/get/"+id,String.class);

    }

}
